package com.joey.cloud.flowable.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.joey.cloud.communal.constant.BaseConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.flowable.engine.history.HistoricProcessInstance;

import java.io.Serializable;
import java.util.Date;

@ApiModel(value="流程实例信息")
@Data
public class FlowProcessVo implements Serializable {
    private static final long serialVersionUID=1L;

    @ApiModelProperty(value = "实例id")
    private String processId;
    @ApiModelProperty(value = "实例名称")
    private String processName;
    @ApiModelProperty(value = "业务key")
    private String businessKey;
    @ApiModelProperty(value = "流程定义id")
    private String definitionId;
    @ApiModelProperty(value = "流程定义key")
    private String definitionKey;
    @ApiModelProperty(value = "流程定义名称")
    private String definitionName;
    @ApiModelProperty(value = "流程描述")
    private String description;
    @ApiModelProperty(value = "部署id")
    private String deploymentId;
    @ApiModelProperty(value = "发起人id")
    private String startUserId;
    @ApiModelProperty(value = "发起人名称")
    private String startUserName;
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = BaseConstant.entity_date_format)
    private Date startTime;
    @ApiModelProperty(value = "结束时间")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = BaseConstant.entity_date_format)
    private Date endTime;

    public FlowProcessVo(){}
    public FlowProcessVo(HistoricProcessInstance item){
        this.processId = item.getId();
        this.processName = item.getName();
        this.businessKey = item.getBusinessKey();
        this.definitionId = item.getProcessDefinitionId();
        this.definitionKey = item.getProcessDefinitionKey();
        this.definitionName = item.getProcessDefinitionName();
        this.deploymentId = item.getDeploymentId();
        this.startUserId = item.getStartUserId();
        this.startTime = item.getStartTime();
        this.endTime = item.getEndTime();
        this.description = item.getDescription();
    }
}
